﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using DAL;
using Model;
using IDAL;
using BLL;

namespace EstateService.Controllers
{
    public class IndoorController : ApiController
    {
        BLL.Factory<IIndoorDAL, IndoorDAL> bll = new Factory<IIndoorDAL, IndoorDAL>();

        // GET api/indoor
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/indoor/5
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Indoor Get(int id)
        {
            string wherestr = "projectNumber=" + id + "";
            return bll.bll().getmodel<Indoor>(wherestr);
        }

        // POST api/indoor
        public void Post([FromBody]string value)
        {

        }

        // PUT api/indoor/5
        public int Put(int id, [FromBody]Indoor value)
        {
            string wherestr = "projectNumber=" + id + "";

            return bll.bll().updates<Indoor>(value, wherestr);
        }

        // DELETE api/indoor/5
        public void Delete(int id)
        {
        }
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="mo"></param>
        /// <returns></returns>
        [HttpPost]
        [ActionName("IndoorAdd")]
        public int IndoorAdd(Indoor mo)
        {
            return bll.bll().insert<Indoor>(mo);
        }

    }
}
